route.ts 539 B

1234567891011
  1. import { NextRequest, NextResponse } from 'next/server';
  2. import { ResultDto } from '@/types/response/common';
  3. import { fetchJson } from '@/lib/utils/server';
  4. export async function GET(request: NextRequest, { params }: { params: Promise<{ path?: string[] }> }) {
  5. const { path } = await params;
  6. const endpoint = `/api/wallet${path && path.length > 0 ? `/${path.join('/')}` : ''}`;
  7. const url = new URL(request.url);
  8. const res: ResultDto = await fetchJson(`${endpoint}${url.search}`, { method: 'GET' });
  9. return NextResponse.json(res);
  10. }